package com.jiesen.base.modules.login.jsPermission.mapper;

import com.jiesen.base.baseDao.BaseMapper;
import com.jiesen.base.modules.login.jsPermission.model.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

@Mapper
public interface PermissionDao extends BaseMapper<Permission> {

    //根据角色id查询该角色所拥有的所有权限
    @Select("select `id`,`sort`,`parent_id`,`name`,`type`,`path`,`percode`,`lock`,`updatetime`,`addtime`,`icon` " +
            "from `sys_permission` where `id` in " +
            "(select `sys_permission_id` from `sys_role_permission` where `sys_role_id` = #{id} ) " +
            "order by `id` ")
    public List<Permission> findPermissionByRoleId(@Param("id") Serializable id);

}
